﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace B.S.AuthCenter.Api.Read
{
    public class GlobalExceptionFilter : IExceptionFilter
    {
        ILogger<GlobalExceptionFilter> Logger;

        public GlobalExceptionFilter(ILogger<GlobalExceptionFilter> logger)
        {
            this.Logger = logger;
        }

        public void OnException(ExceptionContext context)
        {
            Logger.LogError("发生全局异常" + context.Exception.Message);
            context.ExceptionHandled = true;
        }
    }
}
